<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('Summernote富文本编辑器')"/>
    <th:block th:include="include :: summernote-css"/>
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-flow-add" th:object="${report}">
            <input type="hidden" name="idReport" th:field="*{idReport}" id="idReport"/>
            <input type="hidden" name="note" th:field="*{note}" id="note"/>
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">项目：</label>
                <div class="col-sm-8">
                    <input name="na" class="form-control" type="text" th:field="*{na}" readonly>
                </div>
            </div>
            <div class="row">
                <div class="col-sm-12">
                    <div class="ibox float-e-margins">
                        <div class="ibox-content no-padding">
                            <div class="summernote">
                                <p>
                                    [[*{note}]]
                                </p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: summernote-js"/>
<script th:inline="javascript">
        var prefix = ctx + "base/report";
        $("#form-flow-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            debugger;
            var msg = $(".summernote").summernote('code');
            $("#note").val(msg);
            $.ajax({
                url: prefix+"/edit",
                type: 'POST',
                dataType: 'json',
                data: $('#form-flow-add').serialize(),
                success: function (result) {
                    if(result.code=="0") {
                        $.modal.close();
                    }
                }
            });
        }


       $(document).ready(function () {
            $('.summernote').summernote({
                lang: 'zh-CN'
            });
        });

        $(function() {
            $(".summernote").summernote('code',$("#note").val());
            var type =[[${type}]];
            if(type=="no") {
                $('.summernote').summernote('destroy');
            }
        });
</script>
</body>
</html>